//milestone_edit
var milestone_edit=function(){

	return{
		initTeamData:function(){
            var project_id =$('#project_id').attr("value");
			var params = {'p_id': project_id};
			$('#owner_text').combobox({
				url      : "team_in_project",
				queryParams: params,
				emptyText: language.milestone.chose_leader,
				onselect : function () {	
					$("#owner").attr("value", $('#owner_text').combobox("value"));
					$("#owner_name").attr("value", $('#owner_text').combobox("text"));
				}
			});	
		}
		
	} 	
} ();
$('#milestone_form').ajaxForm({
    dataType:'json',
    beforeSubmit:function () {
        if (!$.isValid()) {
            return false;
        }
        $('#btn_submit').attr('disabled', 'disabled');
        cdms.common.show_info('tr_form_msg', language.project.wait_submit_msg);
    },
    success:function (json) {
        $('#btn_submit').removeAttr('disabled');
        if (json.type) {
            $.alert({
                title:language.note.alert_title,
                message:json.msg,
                fnOk:function () {
                    window.location.href = "list/"+code;
                }
            });
        } else {
            cdms.common.show_error('tr_form_msg', json.msg);
        }
    }
});
$(document).ready(function () {

    //页面加载时，初始化project的combobox
   milestone_edit.initTeamData();
});


